package com.shan.domm.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shan.domm.common.ErrorCode;
import com.shan.domm.exception.BusinessException;
import com.shan.domm.model.domain.Announcement;
import com.shan.domm.model.domain.DTOs.AnnouncementDTO;
import com.shan.domm.service.AnnouncementService;
import com.shan.domm.mapper.AnnouncementMapper;
import com.shan.domm.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 23949
* @description 针对表【announcement(公告)】的数据库操作Service实现
* @createDate 2024-04-08 15:03:56
*/
@Service
public class announcementServiceImpl extends ServiceImpl<AnnouncementMapper, Announcement>
    implements AnnouncementService {

    @Autowired
    private RedisUtil redisUtil;

    @Override
    public String Addannouncement(Announcement announcement) {
        if(announcement==null){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"参数为空");
        }
        boolean i=this.save(announcement);


        if(!i){
            return "添加失败";
        }
        return "添加成功";
    }
}




